<div class="tabbable tabs-left">
    <?php echo $this->partial('analytics/analytics/left_menu.phtml'); ?>
    <div class="tab-content">
        <style>
            .table td {
                border-top: 0;
            }
        </style>
        <table class="table table-striped table-bordered">
            <thead>
            <th><?php echo $this->translate('客户统计'); ?></th>
            </thead>
            <tbody>
            <tr>
                <td width="25%"><b><?php echo $this->translate('今日新增客户'); ?>：</b><?php echo $this->day_user_total; ?></td>
                <td width="25%"><b><?php echo $this->translate('本月新增客户'); ?>：</b><?php echo $this->month_user_total; ?></td>
                <td width="25%"><b><?php echo $this->translate('客户总数'); ?>：</b><?php echo $this->user_total; ?></td>
                <td width="25%"><b><?php echo $this->translate('购买过商品的客户数'); ?>：</b><?php echo $this->user_buyer_total; ?></td>
            </tr>
            <tr style="font-weight: bold;">
                <form method="post" action="">
                <td colspan="4" style="text-align: right;line-height: 40px;">
                    <a href="<?php echo $this->url('analytics/default', array('controller'=>'Analytics', 'action'=>'userStats'), array('query'=>array('dateNum'=>7))); ?>" class="btn <?php if($this->date_num == 6) echo 'btn-primary'; ?>"><?php echo $this->translate('最近7天'); ?></a>&nbsp;
                    <a href="<?php echo $this->url('analytics/default', array('controller'=>'Analytics', 'action'=>'userStats'), array('query'=>array('dateNum'=>30))); ?>" class="btn <?php if($this->date_num == 29) echo 'btn-primary'; ?>"><?php echo $this->translate('最近30天'); ?></a>&nbsp;&nbsp;
                    <input type="text" class="span2 Wdate" name="start_time" id="start_time" value="<?php if(isset($this->start_time)) echo $this->start_time; ?>" onclick="WdatePicker({el:'start_time', dateFmt:'yyyy-MM-dd'})">
                    ~
                    <input type="text" class="span2 Wdate" name="end_time" id="end_time" value="<?php if(isset($this->end_time)) echo $this->end_time; ?>"  onclick="WdatePicker({el:'end_time', dateFmt:'yyyy-MM-dd'})">
                    <button type="submit" class="btn btn-primary"><?php echo $this->translate('查看'); ?></button>
                </td>
                </form>
            </tr>
            <tr>
                <td colspan="4">
                    <div id="user_chart" style="width: 100%;height: 400px;margin-top: 20px;"></div>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
</div>
<script src="<?php echo $this->basePath('/public/js/DatePicker/WdatePicker.js'); ?>"></script>
<script>
    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('user_chart'), dbshop_echarts_stype);
    option = {
        title: {
            text: '<?php echo $this->translate('客户统计图表'); ?>'
        },
        tooltip : {
            trigger: 'axis'
        },
        legend: {
            data:['<?php echo $this->translate('新增客户'); ?>','<?php echo $this->translate('下单量'); ?>']
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        xAxis : [
            {
                type : 'category',
                boundaryGap : false,
                data : [<?php echo $this->date_str; ?>]
            }
        ],
        yAxis : [
            {
                type : 'value'
            }
        ],
        series : [
            {
                name:'<?php echo $this->translate('新增客户'); ?>',
                type:'line',
                data:[<?php echo $this->week_user; ?>]
            },
            {
                name:'<?php echo $this->translate('下单量'); ?>',
                type:'line',
                data:[<?php echo $this->week_order; ?>]
            }
        ]
    };
    myChart.setOption(option);
</script>